/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.ejb.Stateful;
import javax.inject.Named;

/**
 *
 * @author Emergenza
 */
@Named ("homeBean")
@Stateful
public class HomeMainBean {

    User u;
    ArrayList <Event> events;

    public HomeMainBean() {
        u = new User("Mattia", "Gianotti", "ma.g@a.l", true);
        events = new ArrayList<Event>();
        events.add(new Event());
        
        GregorianCalendar d = new  GregorianCalendar(10, 11, 12, 14, 30);
        events.add(new Event("Ciao", "dwsbvwdvbdw", "Rainy", d));
    }
    public String getName(){
        return (u.getName() + " " + u.getSurname());
    }
    public String getEventName(int i){
        for (Event e : events){
            if(e.getStart().get(Calendar.HOUR) == i){
                System.out.println(e.getStart().get(Calendar.HOUR));
                return(e.getName());
            }
        }
        return " " ;
    }
    public boolean isVisible(int i){
        for(Event e : events){
            if(e.getStart().get(Calendar.HOUR) == i){
                return true;
            }
        }
        return false;
    }
    
}
